// import {reqCategoryList,reqBannerList,reqFloorList} from '@/api'

// const state = {
//     categoryList:[],
//     bannerList:[],
//     floorList:[]
// }
// const mutations  = {
//     RECEIVE_CATEGORYNAME(state,categoryList){
//         state.categoryList = categoryList
//     },
//     RECEIVE_BANNERLIST(state,bannerList){
//         state.bannerList = bannerList
//     },
//     receive_floorList(state,floorList){
//         state.floorList = floorList
//     }
// }
// const actions ={
//     //  异步请求获取数据,提交给mutations  修改state
//     async getCategoryList({commit}){
//         const result = await reqCategoryList()
//         if(result.code === 200){
//             commit('RECEIVE_CATEGORYLIST',result.data)
//         }
//     },
//     async getBannerList({commit}){
//         const result =await reqBannerList()
//         if(result.code === 200){
//             commit('receive_bannerList',result.data)
//         }
//     },
//     async getFloorList({commit}){
//         const result =await reqFloorList()
//         if(result.code === 200){
//             commit('receive_floorList',result.data)
//         }
//     }
// }
// const getters = {}


// export default {
//     state,
//     mutations,
//     actions,
//     getters
// }


import {reqCategoryList,reqBannerList,reqFloorList} from '@/api'


const state = {
    categoryList:[],
    bannerList:[],
    floorList:[]
}
const mutations = {
    RECEIVE_CATEGORYLIST(state,categoryList){
        state.categoryList = categoryList
    },
    RECEIVE_BANNERLIST(state,bannerList){
        state.bannerList = bannerList
    },
    RECEIVE_FLOORLIST(state,floorList){
        state.floorList  = floorList
    }
}
const actions = {
    async getCategoryList({commit}){
        const result =await reqCategoryList()
        if(result.code === 200)[
            commit('RECEIVE_CATEGORYLIST',result.data)
        ]
    },

    async getBannerList({commit}){
        const result =await reqBannerList()
        if(result.code === 200){
            commit('RECEIVE_BANNERLIST',result.data)
        }
    },

    async getFloorList(){
        const result =await reqFloorList()
        if(result.code === 200){
            commit('RECEIVE_FLOORLIST',result.data)
        }
    }
}
const getters = {}



export default {
    state,
    mutations,
    actions,
    getters
}